from PIL import Image, ImageDraw


def remove_watermark(input_image_path, output_image_path):
    # 打开图片
    image = Image.open(input_image_path)

    # 创建绘图对象
    draw = ImageDraw.Draw(image)

    # 假设水印位于图片的右下角，并且大小是固定的
    watermark_area = (image.width - 100, image.height - 50, image.width, image.height)

    # 覆盖水印区域，颜色可以根据背景进行调整
    draw.rectangle(watermark_area, fill=(255, 255, 255))

    # 保存去除水印后的图片
    image.save(output_image_path)


if __name__ == "__main__":
    input_image_path = r'/Users/admin/Downloads/去水印.png'
    output_image_path = r'/Users/admin/Downloads/去水印1.png'
    remove_watermark(input_image_path, output_image_path)
